ig.module(
	'game.entities.player'
)
.requires(
	'impact.entity',
        'game.entities.base.entityBase'
)
.defines(function()
{
    EntityPlayer = EntityEntityBase.extend(
    {
        size: {x:37, y:50},     
	collides: ig.Entity.COLLIDES.PASSIVE,
        animSheet: new ig.AnimationSheet('media/images/pin.png', 37, 54),
        
        init: function(x, y, settings)
        {
            ig.global.touched = 0;
            this.parent(x, y, settings);
            this.addAnim('Idle', 1, [0]);
        },
        
        touches: function(other)
        {
	    /*
            ig.global.touched++;
            
            if (other instanceof EntityPickableType)
            {                
                other.onPick();                
            }
	    */
	    
            return this.parent(other);            
        },
        
        update: function()
        {
            this.parent();
            
	    var validPicks = ig.game.getEntitiesByType(EntityPickableType);
	    
	    for (var i = 0; i < validPicks.length; ++i)
	    {
		if (this.touches(validPicks[i]) == true)
		{
		    ig.global.touched++;
		    validPicks[i].onPick();    
		}
	    }
	    
            if (ig.input.state('left'))
            {
                this.vel.x = -100;
            }
            else if (ig.input.state('right'))
            {
                this.vel.x = 100;                
            }
            else
            {
                this.vel.x = 0;                
            }
        },
        
        draw: function()
        {
            this.parent();
        },        
    });
});